package com.ctgu.A1_3;

import java.util.ArrayList;

public class main {
    public static void main(String[] args) {
        /**
         * 说明：
         * 一个学院School由1到多个系Department构成；
         * 每个系至少拥有1位指导教师Instructor，并提供至少1门课程Subject；
         * 每个指导教师至少属于某个系且教授1-3门课程；
         * 学院拥有0到多名学生，学生Student参加1-5门课程学习。
         *
         * 类：School、Department、Instructor、Student、Subject
         * School: name, address, List<Department>
         * Department: name, List<Subject>, List<Instructor>, List<Student>
         * Instructor: name, List<Subject>
         * Subject: name, score
         * Student: name, id, School, List<Subject>
         */
        System.out.println(school);//获取整个学校的信息
        System.out.println("==========获取第二个系的信息===========");
        System.out.println(school.getDepartmentList().get(1));//获取第二个系的信息
        System.out.println("==========获取第二个系的第二个课程的信息===========");
        System.out.println(school.getDepartmentList().get(1).getSubjectList().get(1));//获取第二个系的第二个课程的信息
        System.out.println("==========获取第二个系的第二个指导教师信息===========");
        System.out.println(school.getDepartmentList().get(1).getInstructorList().get(1));//获取第二个系的第二个指导教师信息
        System.out.println("==========获取第二个系的第二个学生信息===========");
        System.out.println(school.getDepartmentList().get(1).getStudentList().get(1));
    }
    public static School school=new School("CTGU","中国·宜昌", initDepartmentList());
    public static ArrayList<Department> initDepartmentList(){
        ArrayList<Department> departmentList = new ArrayList<>();
        departmentList.add(new Department("计算机系", initSubjectList().subList(0, 3), initInstructorList().subList(0, 1), initStudentList()));
        departmentList.add(new Department("软件系", initSubjectList().subList(2, 4), initInstructorList().subList(0, 2), initStudentList()));
        departmentList.add(new Department("网络系", initSubjectList().subList(0, 4), initInstructorList().subList(1, 2), initStudentList()));
        return departmentList;
    }
    public static ArrayList<Instructor> initInstructorList(){
        ArrayList<Instructor> instructorList = new ArrayList<>();
        instructorList.add(new Instructor("张老师", initSubjectList().subList(1, 4)));
        instructorList.add(new Instructor("李老师", initSubjectList().subList(0, 3)));
        instructorList.add(new Instructor("王老师", initSubjectList().subList(2, 4)));
        return instructorList;
    }
    public static ArrayList<Student> initStudentList(){
        ArrayList<Student> studentList = new ArrayList<>();
        studentList.add(new Student("张三", 20220001, "CTGU", initSubjectList().subList(0, 3)));
        studentList.add(new Student("李四", 20220002, "CTGU", initSubjectList().subList(2, 4)));
        studentList.add(new Student("王五", 20220003, "CTGU", initSubjectList().subList(0, 4)));
        return studentList;
    }
    public static ArrayList<Subject> initSubjectList(){
        ArrayList<Subject> subjectList = new ArrayList<>();
        subjectList.add(new Subject("Java", 4.0));
        subjectList.add(new Subject("C++", 3.5));
        subjectList.add(new Subject("Python", 2.0));
        subjectList.add(new Subject("JavaScript", 2.5));
        subjectList.add(new Subject("PHP", 2.0));
        return subjectList;
    }
}
